package com.wuhan.template.module.wode.fragment;

import android.util.Log;

import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.wuhan.template.R;
import com.wuhan.template.base.BaseApplication;
import com.wuhan.template.base.BaseFragment;
import com.wuhan.template.module.find.bean.CollectionEntity;
import com.wuhan.template.module.wode.adapter.CollectionListAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
import greendao.DaoSession;
import greendao.DetailTable;
import greendao.DetailTableDao;

/**
 * Created by Administrator on 2016/5/14 0014.
 */
public class WordCollectFragment extends BaseFragment{

    @BindView(R.id.word_pullListView)
    PullToRefreshListView listView;
    private List<DetailTable> detailTable = new ArrayList<>();

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_word_collect;
    }

    @Override
    protected void initViews() {





        DaoSession daoSession = ((BaseApplication) getActivity().getApplication()).getDaoSession();

       /* Query query = daoSession.getDetailTableDao().queryBuilder()
                .where(DetailTableDao.Properties.PicUrl.l)
                .build();*/

        detailTable.addAll(daoSession.getDetailTableDao().loadAll());
     //   adapter.notifyDataSetChanged();

        // 在 QueryBuilder 类中内置两个 Flag 用于方便输出执行的 SQL 语句与传递参数的值
        QueryBuilder.LOG_SQL = true;
        QueryBuilder.LOG_VALUES = true;
         CollectionListAdapter adapter = new CollectionListAdapter(getActivity(),detailTable);
         listView.setAdapter(adapter);                                                                /* .orderAsc(DetailTableDao.Properties.Time)
                .where(DetailTableDao.Properties.Time.);*/
    }
}
